package chapter25;

public class GreetStudents {
    public static void main(String[] args) {
        Runnable print1 = new PrintChar("hello java", 50);
        Runnable print2 = new PrintChar("goodbye java", 50);
        Thread thread1 = new Thread((print1));
        Thread thread2 = new Thread((print2));
        thread1.start();
        thread2.start();

        chapter25.Student stu1 = new chapter25.Student("6666","张三","男");
        chapter25.Student stu2 = new chapter25.Student("7777","李四","女");
        chapter25.Student stu3 = new chapter25.Student("8888","王五","不男不女");
        chapter25.Student[]  studs1 = {stu1,stu2,stu3};
        Runnable printStudent = new StudentInFo(studs1);
        Thread thread3 = new Thread((printStudent));
        thread3.start();
    }

    // 任务一
    public static class PrintChar implements Runnable {
        private String greeting;
        private int count;

        public PrintChar(String g, int c) {
            greeting = g;
            count = c;
        }

        @Override
        public void run() {
            for (int i = 0; i <= count; i++) {
                System.out.println(greeting);
            }
        }
    }

}